const app = getApp();
const accountInfo = wx.getAccountInfoSync();
//版本信息
const envVersion = accountInfo.miniProgram.envVersion;
const devMenuData = [
    {
        title: "风险管控及隐患治理",
        children: [{
            title: '隐患提报',
            name: 'risk-staff',
            package: "pages",
            icon: 't-icon-chaoqi-copy'
        },
            {
                title: '员工隐患',
                name: 'risk-list',
                color: 'red',
                package: "pages",
                icon: 't-icon-duogezhongdianrenyuanjujiquyu-copy'
            },
            {
                title: '风险告知',
                name: 'risk-notice',
                package: "pages",
                icon: 't-icon-fengxian-copy'
            },
            {
                title: '隐患跟踪',
                name: 'yinHuanGz',
                package: "subPages",
                icon: 't-icon-hengshanapp_gongzuo_yinhuangenzong-copy'
            }
        ]
    },
    {
        title: "安全培训教育管理",
        children: [
            {
                title: '培训课程',
                name: 'my-exam-home',
                package: "pages",
                icon: 't-icon-peixunkecheng-copy',
                params: "?type=1"
            }
        ]
    },
    {
        title: "特种作业人员管理",
        children: [{
            title: '证件管理',
            name: 'zhengJianGl',
            package: "subPages",
            icon: 't-icon-shenfengzheng-copy-copy',
        },
        ]
    },
    {
        title: "特种设备管理",
        children: [{
            title: '周排查',
            name: 'se-check-list',
            package: "pages",
            icon: 't-icon-meizhouyiwen-copy',
        },
            {
                title: '月会议',
                name: 'se-meeting-list',
                package: "pages",
                icon: 't-icon-huiyi-copy',
            }
        ]
    },
    {
        title: "班组安全数据",
        children: [
            {
                title: '新增',
                name: 'personSafety-add',
                package: "pages",
                icon: 't-icon-wodekaoshi-copy',
            },
            {
                title: '审批',
                name: 'personSafety-list',
                package: "pages",
                icon: 't-icon-falvfagui20x20-copy',
            },
            {
                title: '提交记录',
                name: 'personSafety-mySafety',
                package: "pages",
                icon: 't-icon-kecheng--copy',
            },
            {
                title: '安全记录卡',
                name: 'personSafety-card',
                package: "pages",
                icon: 't-icon-shenfengzheng-copy-copy',
            },
            {
                title: '班组考评',
                name: 'personSafety-teamRep',
                package: "pages",
                icon: 't-icon-crmricheng-copy',
            },
        ]
    },
]
const prodMenuData = [
    {
        title: "风险管控及隐患治理",
        children: [{
            title: '隐患提报',
            name: 'risk-staff',
            package: "pages",
            icon: 't-icon-chaoqi-copy'
        },
            {
                title: '员工隐患',
                name: 'risk-list',
                color: 'red',
                package: "pages",
                icon: 't-icon-duogezhongdianrenyuanjujiquyu-copy'
            },
            {
                title: '风险告知',
                name: 'risk-notice',
                package: "pages",
                icon: 't-icon-fengxian-copy'
            },
            {
                title: '隐患跟踪',
                name: 'yinHuanGz',
                package: "subPages",
                icon: 't-icon-hengshanapp_gongzuo_yinhuangenzong-copy'
            }
        ]
    },
    {
        title: "安全培训教育管理",
        children: [
            {
                title: '培训课程',
                name: 'my-exam-home',
                package: "pages",
                icon: 't-icon-peixunkecheng-copy',
                params: "?type=1"
            }
        ]
    },
    {
        title: "特种作业人员管理",
        children: [{
            title: '证件管理',
            name: 'zhengJianGl',
            package: "subPages",
            icon: 't-icon-shenfengzheng-copy-copy',
        },
        ]
    },
    {
        title: "特种设备管理",
        children: [{
            title: '周排查',
            name: 'se-check-list',
            package: "pages",
            icon: 't-icon-meizhouyiwen-copy',
        },
            {
                title: '月会议',
                name: 'se-meeting-list',
                package: "pages",
                icon: 't-icon-huiyi-copy',
            }
        ]
    },
    {
        title: "班组安全数据",
        children: [
            {
                title: '新增',
                name: 'personSafety-add',
                package: "pages",
                icon: 't-icon-wodekaoshi-copy',
            },
            {
                title: '审批',
                name: 'personSafety-list',
                package: "pages",
                icon: 't-icon-falvfagui20x20-copy',
            },
            {
                title: '提交记录',
                name: 'personSafety-mySafety',
                package: "pages",
                icon: 't-icon-kecheng--copy',
            },
            {
                title: '安全记录卡',
                name: 'personSafety-card',
                package: "pages",
                icon: 't-icon-shenfengzheng-copy-copy',
            },
        ]
    },
]
Page({
    options: {
        addGlobalClass: true,
    },
    data: {
        menuData: envVersion === 'release' ? prodMenuData : devMenuData,
        modalHidden: true, // 弹窗默认隐藏
        imageUrl: '/public/img/law.png'
    },

    showModal() {
        this.setData({
            modalHidden: false
        });
    },
    // 点击“关闭”按钮，隐藏弹窗
    hideModal() {
        this.setData({
            modalHidden: true
        });
    },

    onShow() {
        //校验登录状态
        app.checkAuth()
    },


    gotoYhTb() {
        wx.navigateTo({
            url: '/pages/risk-staff/risk-staff',
        })
    }
})